﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Library.BIZ
{
    public partial class SanPhamBIZ : DAL.SanPham
    {
        public SanPhamBIZ()
        {
        }

        public SanPhamBIZ(int id)
        {
            SanPhamBIZ s = DAL.SanPhamDAL.GetByID(id);
            if (s != null)
            {
                this.ID = s.ID;
                this.MaSP = s.MaSP;
                this.TenSP = s.TenSP;
                this.HangSanXuat = s.HangSanXuat;
                this.MoTa = s.MoTa;
                this.Gia = s.Gia;
                this.HinhAnh = s.HinhAnh;
            }
        }

        public SanPhamBIZ(string masp)
        {
            SanPhamBIZ s = DAL.SanPhamDAL.GetByMaSP(masp);
            this.ID = s.ID;
            this.MaSP = s.MaSP;
            this.TenSP = s.TenSP;
            this.HangSanXuat = s.HangSanXuat;
            this.MoTa = s.MoTa;
            this.Gia = s.Gia;
            this.HinhAnh = s.HinhAnh;
        }

        public int Add()
        {
            return DAL.SanPhamDAL.Add(this);
        }

        public bool Delete()
        {
            return DAL.SanPhamDAL.Delete(this);
        }

        public bool Update()
        {
            return DAL.SanPhamDAL.Update(this);
        }
    }
}
